from goodsapp.sers import *
from .models import *


class OrderSer(serializers.ModelSerializer):
    class Meta:
        model = Order
        fields = "__all__"


class OrderItemSer(serializers.ModelSerializer):
    goods = GoodsListSer()

    class Meta:
        model = OrderItem
        fields = "__all__"


class OrderListSer(serializers.ModelSerializer):
    items = OrderItemSer(many=True, read_only=True)

    class Meta:
        model = Order
        fields = "__all__"
